<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#findNoticeByTitleBtn").click(function(){
			var keyword=$("#keyword").val();
			if($("#keyword").val()==""){
				alert("검색할 내용을 입력하세요.");
				return false;
			}
			if($("#search").val()=="title"){
				location.href="findNoticeListByTitle.do?title="+keyword;
			}else if($("#search").val()=="content"){
				location.href="findNoticeListByContent.do?content="+keyword;
			}else{
				alert("검색할 내용을 선택하세요.");
			}//if
		});//click
	});//ready
</script>
</head>
<body>
<h1>공지사항</h1>
<font size="2">
회원님께서 Where is my Teacher를 편리하게 이용할 수 있도록 알려드리고 있습니다.
<br>
이용에 불편이 없도록 공지사항을 확인하세요.
</font>
<br>
<br>
<center>
<table bordercolor="lightgrey" style="border-width: 0.5mm;" bgcolor="#F8F8F8">
	<thead >
	<tr bgcolor="#E6E6E6">
	<td><font size="2">번호</font></td>
	<td width="250"><font size="2">제목</font></td>
	<td><font size="2">작성자</font></td>
	<td><font size="2">작성일</font>
	</td><td><font size="2">조회수</font></td>
	</tr>
	</thead>
	<tbody>
	<c:forEach items="${requestScope.list.list }" var="list">
	<tr>
	<td><font size="2">${list.no }</font></td>
	<td><a href="showNoticeInfo.do?no=${list.no }"><font size="2">${list.title }</font></a></td>
	<td><font size="2">${list.writer }</font></td><td><font size="2">${list.datePosted }</font></td>
	<td><font size="2">${list.hits }</font></td>
	</tr>
	</c:forEach>
	</tbody>
</table>
<br>

<c:if test="${requestScope.list.pagingBean.previousPageGroup }">
<a href="findNoticeListByContent.do?content=${requestScope.content }&pageNo=${requestScope.list.pagingBean.startPageOfPageGroup-1}">◀</a>
</c:if>
&nbsp;&nbsp;
<c:forEach var="i" 
begin="${requestScope.list.pagingBean.startPageOfPageGroup}"
end="${requestScope.list.pagingBean.endPageOfPageGroup}">
	<c:choose>
		<c:when test="${requestScope.list.pagingBean.nowPage!=i}">
		<a href="findNoticeListByContent.do?content=${requestScope.content }&pageNo=${i}">${i}</a>
		</c:when>
		<c:otherwise>
		${i}
		</c:otherwise>
	</c:choose>
</c:forEach>
&nbsp;&nbsp;
<c:if test="${requestScope.list.pagingBean.nextPageGroup}">
<a href="findNoticeListByContent.do?content=${requestScope.content }&pageNo=${requestScope.list.pagingBean.endPageOfPageGroup+1}">▶</a>
</c:if>
<br>
<br>
<select id="search">
	<option>--</option>
	<option value="title">제목</option>
	<option value="content">내용</option>
</select>
<input type="text" name="keyword" id="keyword">
<input type="button" id="findNoticeByTitleBtn" value="검색">
</center>
</body>
</html>